package com.example.xln111.Dao;

import com.example.xln111.model.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
        @Select("SELECT * FROM course")
        public List<Course> getAll();

        @Insert("INSERT INTO course(id,courseName,teacherName) VALUES(#{id},#{courseName},#{teacherName})")
        public int addCourse(Course course);

        @Update("UPDATE course SET courseName = #{courseName},teacherName = #{teacherName} WHERE id = #{id}")
        public int updateCourse(Course course);

        @Delete("DELETE FROM course WHERE id = #{id}")
        public int deleteCourseById(int id);

        @Select("SELECT * FROM course WHERE id = #{id}")
        public Course getCourseById(int id);
    }

